DEFINITION MODULE WindMgr;

(*
AES Window Manager.

UK __DATE__ __TIME__
*)

(*DEF_SWITCHES*)

FROM RcMgr  IMPORT GRect,GPnt;
FROM PORTAB IMPORT SIGNEDWORD,UNSIGNEDWORD;

(* [Wind]ow Manager: [Create] Window, AES(100) *****************************)

CONST NoWindow = -1;

#if revers
TYPE WindowElements = (W15,W14,
                       Backdrop,
                       HotClose,
                       HSlide,  (* [H]orizontal [Slide] *)
                       RtArrow, (* [R]igh[t] [Arrow]    *)
                       LfArrow, (* [L]e[f]t [Arrow]     *)
                       VSlide,  (* [V]ertical [Slide]   *)
                       DnArrow, (* [D]ow[n] [Arrow]     *)
                       UpArrow, (* [Up] [Arrow]         *)
                       Size,
                       Info,
                       Move,
                       Full,
                       Close,
                       Name);
#else
TYPE WindowElements = (Name,
                       Close,
                       Full,
                       Move,
                       Info,
                       Size,
                       UpArrow, (* [Up] [Arrow]         *)
                       DnArrow, (* [D]ow[n] [Arrow]     *)
                       VSlide,  (* [V]ertical [Slide]   *)
                       LfArrow, (* [L]e[f]t [Arrow]     *)
                       RtArrow, (* [R]igh[t] [Arrow]    *)
                       HSlide,  (* [H]orizontal [Slide] *)
                       HotClose,
                       Backdrop,
                       W14,W15);
#endif
(* alias *)

CONST Mover  = Move;
      Fuller = Full;
      Closer = Close;

      HotCloseBox = HotClose;

TYPE WindowElement = PACKEDSET OF WindowElements;

     Wind = WindowElement; (* alias *)

PROCEDURE WindCreate(    Kind   : WindowElement;
                     VAR MaxRect: GRect): SIGNEDWORD;

(* [Wind]ow Manager: [Open] Window, AES(101) *******************************)

PROCEDURE WindOpen(    Handle   : SIGNEDWORD;
                   VAR StartRect: GRect);

(* [Wind]ow Manager: [Close] Window, AES(102) ******************************)

PROCEDURE WindClose(Handle: SIGNEDWORD);

(* [Wind]ow Manager: [Delete] Window, AES(103) *****************************)

PROCEDURE WindDelete(VAR Handle: SIGNEDWORD);

(* [Wind]ow Manager: [Get] Window Parameters, AES(104) *********************)

CONST Desk = 0;

TYPE WindowFunctions = (WFResvd1,
                        WFKind,
                        WFName,
                        WFInfo,
                        WFWorkXYWH,
                        WFCurrXYWH,  (* [Curr]ent [XYWH]             *)
                        WFPrevXYWH,  (* [Prev]ious [XYWH]            *)
                        WFFullXYWH,  (* [Full] [XYWH]                *)
                        WFHSlide,    (* [H]orizontal [Slide]         *)
                        WFVSlide,    (* [V]ertical [Slide]           *)
                        WFTop,       (* [Top]                        *)
                        WFFirstXYWH,
                        WFNextXYWH,
                        WFResvd2,
                        WFNewDesk,   (* [New] [Desk]                 *)
                        WFHSlSize,   (* [H]orizontal [Sl]ider [Size] *)
                        WFVSlSize,   (* [V]ertical [Sl]ider [Size]   *)
                        WFScreen,    (* [Screen] Buffer              *)
                        WFTAttrb,
                        WFSizTop,
                        WFTopAp,     (* [Top] [Ap]plication          *)
                        WFResvd3,
                        WFResvd4,
                        WFResvd5,
                        WFBEvent,
                        WFBottom);

CONST WFBack   = -10;                (* [Back]                       *)
      WFColor  = WFTAttrb;
      WFDColor = WFSizTop;           (* [D]efault Color              *)
      WFOwner  = WFTopAp;

      WFBackdrop = 100; (* MagX *)

      WFMOwner   = 101; (* MagX *)
      WFWindList = 102; (* MagX *)

(* alias *)

CONST WFWXYWH = WFWorkXYWH;
      WFCXYWH = WFCurrXYWH;
      WFPXYWH = WFPrevXYWH;
      WFFXYWH = WFFullXYWH;

PROCEDURE WindGet(    Handle: SIGNEDWORD;
                      Field : WindowFunctions;
                  VAR Word1 : SIGNEDWORD;
                  VAR Word2 : SIGNEDWORD;
                  VAR Word3 : SIGNEDWORD;
                  VAR Word4 : SIGNEDWORD);

(* [Wind]ow Manager: [Set] Window Parameters, AES(105) *********************)

PROCEDURE WindSet(Handle: SIGNEDWORD;
                  Field : WindowFunctions;
                  Word1 : SIGNEDWORD;
                  Word2 : SIGNEDWORD;
                  Word3 : SIGNEDWORD;
                  Word4 : SIGNEDWORD);

(* [Wind]ow Manager: [Find] Window, AES(106) *******************************)

PROCEDURE WindFind(XY: GPnt): SIGNEDWORD;

(* [Wind]ow Manager: Window [Update] Mode, AES(107) ************************)

CONST EndUpdate = 0;
      BegUpdate = 1;
      EndMCtrl  = 2;
      BegMCtrl  = 3;
      BegEmerg  = 4;
      EndEmerg  = 5;
      ChkUpdate = 257; (* or add 0100H to BegUpdate *)
      ChkMCtrl  = 259; (* or add 0100H to BegMCtrl  *)

PROCEDURE WindUpdate(BegUp: UNSIGNEDWORD): BOOLEAN;

(* [Wind]ow Manager: [Calc]ulate Window Area, AES(108) *********************)

TYPE CalcModes = (WCBorder,WCWork);

PROCEDURE WindCalc(    Type : CalcModes;
                       Kind : WindowElement;
                   VAR Rect1: GRect;
                   VAR Rect2: GRect);

(* [Wind]ow Manager: [New] Window Memory, AES(109) *************************)

PROCEDURE WindNew;

(* [Wind]ow Manager: [Find] [Ap]plication **********************************)

PROCEDURE WindApFind(MXY: GPnt): SIGNEDWORD;

END WindMgr.

